package inventory.reports.view;

import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.Font;
import javax.swing.JComboBox;
import java.awt.Dimension;
import javax.swing.JSeparator;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

public class OutwardReportView extends JPanel 
{
	private JTextField textFieldFromDate;
	private JTextField textFieldToDate;
	private JTable table;
	
	public OutwardReportView() 
	{
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblFromDate = new JLabel("From Date :");
		lblFromDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblFromDate, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblFromDate, 10, SpringLayout.WEST, this);
		add(lblFromDate);
		
		textFieldFromDate = new JTextField();
		textFieldFromDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, textFieldFromDate, 0, SpringLayout.NORTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, textFieldFromDate, 6, SpringLayout.EAST, lblFromDate);
		add(textFieldFromDate);
		textFieldFromDate.setColumns(10);
		
		JButton btnFromDate = new JButton("Cl");
		btnFromDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, btnFromDate, 0, SpringLayout.NORTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, btnFromDate, 6, SpringLayout.EAST, textFieldFromDate);
		add(btnFromDate);
		
		JLabel lblToDate = new JLabel("To Date :");
		lblToDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblToDate, 0, SpringLayout.NORTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, lblToDate, 20, SpringLayout.EAST, btnFromDate);
		add(lblToDate);
		
		textFieldToDate = new JTextField();
		textFieldToDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, textFieldToDate, 0, SpringLayout.NORTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, textFieldToDate, 6, SpringLayout.EAST, lblToDate);
		add(textFieldToDate);
		textFieldToDate.setColumns(10);
		
		JButton btnToDate = new JButton("Cl1");
		btnToDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, btnToDate, 0, SpringLayout.NORTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, btnToDate, 6, SpringLayout.EAST, textFieldToDate);
		add(btnToDate);
		
		JLabel lblSiteEngineer = new JLabel("Site Engineer");
		lblSiteEngineer.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblSiteEngineer, 31, SpringLayout.SOUTH, lblFromDate);
		springLayout.putConstraint(SpringLayout.WEST, lblSiteEngineer, 0, SpringLayout.WEST, lblFromDate);
		add(lblSiteEngineer);
		
		JComboBox comboBoxSiteEng = new JComboBox();
		comboBoxSiteEng.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboBoxSiteEng.setPreferredSize(new Dimension(200, 20));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxSiteEng, 7, SpringLayout.SOUTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxSiteEng, 0, SpringLayout.WEST, lblFromDate);
		add(comboBoxSiteEng);
		
		JLabel lblContractor = new JLabel("Contractor");
		lblContractor.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblContractor, 0, SpringLayout.NORTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.WEST, lblContractor, 165, SpringLayout.EAST, lblSiteEngineer);
		add(lblContractor);
		
		JComboBox comboBoxContractor = new JComboBox();
		comboBoxContractor.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboBoxContractor.setPreferredSize(new Dimension(200, 20));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxContractor, 0, SpringLayout.NORTH, comboBoxSiteEng);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxContractor, 0, SpringLayout.WEST, lblContractor);
		add(comboBoxContractor);
		
		JLabel lblBuilding = new JLabel("Bldg");
		lblBuilding.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblBuilding, 0, SpringLayout.NORTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.WEST, lblBuilding, 30, SpringLayout.EAST, comboBoxContractor);
		add(lblBuilding);
		
		JComboBox comboBoxBldg = new JComboBox();
		comboBoxBldg.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboBoxBldg.setPreferredSize(new Dimension(100, 20));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxBldg, 0, SpringLayout.NORTH, comboBoxSiteEng);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxBldg, 0, SpringLayout.WEST, lblBuilding);
		add(comboBoxBldg);
		
		JLabel lblFlat = new JLabel("Flat");
		lblFlat.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, lblFlat, 0, SpringLayout.NORTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.WEST, lblFlat, 30, SpringLayout.EAST, comboBoxBldg);
		add(lblFlat);
		
		JComboBox comboBoxFlat = new JComboBox();
		comboBoxFlat.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		comboBoxFlat.setPreferredSize(new Dimension(100, 20));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxFlat, 0, SpringLayout.NORTH, comboBoxSiteEng);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxFlat, 0, SpringLayout.WEST, lblFlat);
		add(comboBoxFlat);
		
		JSeparator separator = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator, 10, SpringLayout.SOUTH, comboBoxSiteEng);
		springLayout.putConstraint(SpringLayout.WEST, separator, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator, -10, SpringLayout.EAST, this);
		add(separator);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 10, SpringLayout.SOUTH, separator);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, -10, SpringLayout.EAST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, -10, SpringLayout.SOUTH, this);
		add(scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null},
			},
			new String[] {
				"Sr. No.", "Material Name", "Specification", "Unit", "Issue Qty"
			}
		));
		scrollPane.setViewportView(table);
		
		JButton btnPrint = new JButton("Print");
		btnPrint.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 13));
		springLayout.putConstraint(SpringLayout.NORTH, btnPrint, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.EAST, btnPrint, -10, SpringLayout.EAST, this);
		add(btnPrint);
	}

}
